package com.maimao.api.sys;

import com.maimao.core.model.resp.Result;
import com.maimao.model.user.sys.Role;
import com.maimao.model.user.sys.dto.DelDto;
import com.maimao.model.user.sys.dto.RoleSearchInput;
import com.maimao.model.user.sys.vo.RoleEx;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2020/11/29 2:00 下午
 */
@Api(value = "后台菜单管理接口")
@RequestMapping("/sys/role")
public interface RoleApi {


    @ApiOperation("分页条件查询角色")
    @PostMapping("/search")
    Result<?> search(
            @RequestParam(value = "page", defaultValue = "1") Integer page,
            @RequestParam(value = "size", defaultValue = "5") Integer size,
            @RequestBody RoleSearchInput input);

    @ApiOperation("角色列表-简化")
    @GetMapping("/list-simple")
    Result<?> list();


    @ApiOperation("添加资源")
    @PostMapping("/add")
    Result<?> add(@Valid @RequestBody RoleEx roleEx, BindingResult bindingResult);

    @ApiOperation("修改资源")
    @PostMapping("/update")
    Result<?> update(@Valid @RequestBody RoleEx roleEx, BindingResult bindingResult);

    @ApiOperation("批量修改状态")
    @PostMapping("/update/status")
    Result<?> updateStatusBatch(@RequestBody DelDto delDto, BindingResult bindingResult);

}
